
import DB.*;
import InformationExtraction.DataExtraction;
import QueryHandler.*;
import java.awt.Color;
import java.awt.Cursor;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Yuval
 */
public class MainFrame extends javax.swing.JFrame {

     private DataExtraction dataEx;   
    /**
     * Creates new form mainFrame
     */
    public MainFrame() {
        dataEx = new DataExtraction();
        initComponents();
        this.setLocationRelativeTo(null);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton1 = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jPanel14 = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        directedByQuery = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jPanel8 = new javax.swing.JPanel();
        directedBy = new javax.swing.JTextField();
        selectDirectorList = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        jPanel10 = new javax.swing.JPanel();
        jLabel16 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel28 = new javax.swing.JLabel();
        jPanel11 = new javax.swing.JPanel();
        directorMovieByYear = new javax.swing.JTextField();
        directorMovieByYearList = new javax.swing.JLabel();
        yearMovieByDirector = new javax.swing.JTextField();
        albumByArtist = new javax.swing.JButton();
        jSeparator2 = new javax.swing.JSeparator();
        jPanel5 = new javax.swing.JPanel();
        jLabel8 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jPanel6 = new javax.swing.JPanel();
        countryText = new javax.swing.JTextField();
        capitelSelectList = new javax.swing.JLabel();
        jSeparator3 = new javax.swing.JSeparator();
        movieByDirectorAndYear = new javax.swing.JButton();
        jSeparator5 = new javax.swing.JSeparator();
        jSeparator1 = new javax.swing.JSeparator();
        movieYearBtn = new javax.swing.JButton();
        jSeparator4 = new javax.swing.JSeparator();
        whenBornBtn = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        bornInList = new javax.swing.JLabel();
        bornInName = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jSeparator6 = new javax.swing.JSeparator();
        profYearBtn = new javax.swing.JButton();
        directedByBtn = new javax.swing.JButton();
        jPanel12 = new javax.swing.JPanel();
        jLabel17 = new javax.swing.JLabel();
        jLabel30 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        atristName = new javax.swing.JTextField();
        artistList = new javax.swing.JLabel();
        jSeparator7 = new javax.swing.JSeparator();
        jPanel13 = new javax.swing.JPanel();
        jLabel19 = new javax.swing.JLabel();
        jLabel32 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        albumsAfterYear = new javax.swing.JTextField();
        jPanel9 = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        movieYear = new javax.swing.JTextField();
        jPanel4 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        profInput = new javax.swing.JTextField();
        profListSelect = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        profYear = new javax.swing.JTextField();
        capitalBtn = new javax.swing.JButton();
        albumAfterYearBtn = new javax.swing.JButton();

        jButton1.setText("jButton1");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Yuval&Michal's Query Simulator");
        setResizable(false);

        directedByQuery.setText("What movies were directed by");

        jLabel11.setText("?");

        selectDirectorList.setForeground(new java.awt.Color(0, 51, 255));
        selectDirectorList.setText("select from list");
        selectDirectorList.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                selectDirectorListMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                selectDirectorListMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                selectDirectorListMouseExited(evt);
            }
        });

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(directedBy)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addComponent(selectDirectorList)
                .addGap(0, 60, Short.MAX_VALUE))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addComponent(directedBy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(selectDirectorList))
        );

        jLabel26.setIcon(new javax.swing.ImageIcon(getClass().getResource("/assistance-support-point-query-icone-3769-32.png"))); // NOI18N

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addComponent(jLabel26)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(directedByQuery)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 10, Short.MAX_VALUE))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addComponent(jLabel26)
                .addGap(0, 0, Short.MAX_VALUE))
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(directedByQuery)
                    .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jLabel16.setText("?");

        jLabel13.setText("Which movies that were directed by");

        jLabel15.setText("were released in");

        jLabel14.setText(",");

        jLabel28.setIcon(new javax.swing.ImageIcon(getClass().getResource("/assistance-support-point-query-icone-3769-32.png"))); // NOI18N

        directorMovieByYearList.setForeground(new java.awt.Color(0, 51, 255));
        directorMovieByYearList.setText("select from list");
        directorMovieByYearList.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                directorMovieByYearListMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                directorMovieByYearListMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                directorMovieByYearListMouseExited(evt);
            }
        });

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(directorMovieByYear)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addComponent(directorMovieByYearList)
                .addGap(0, 72, Short.MAX_VALUE))
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addComponent(directorMovieByYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(directorMovieByYearList))
        );

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addComponent(jLabel28)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel10Layout.createSequentialGroup()
                        .addComponent(jLabel13)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(jPanel10Layout.createSequentialGroup()
                        .addComponent(jLabel15)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(yearMovieByDirector, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(217, 217, 217))))
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel10Layout.createSequentialGroup()
                        .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel28)
                            .addComponent(jLabel13))
                        .addGap(23, 23, 23)
                        .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel15)
                            .addComponent(jLabel16)
                            .addComponent(yearMovieByDirector, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel10Layout.createSequentialGroup()
                        .addGap(12, 12, 12)
                        .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap())
        );

        albumByArtist.setIcon(new javax.swing.ImageIcon(getClass().getResource("/click-n-run-icon.png"))); // NOI18N
        albumByArtist.setText("Go");
        albumByArtist.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                albumByArtistActionPerformed(evt);
            }
        });

        jLabel8.setText("?");

        jLabel7.setText("What is the capital of ");

        jLabel24.setIcon(new javax.swing.ImageIcon(getClass().getResource("/assistance-support-point-query-icone-3769-32.png"))); // NOI18N

        capitelSelectList.setForeground(new java.awt.Color(0, 51, 255));
        capitelSelectList.setText("select from list");
        capitelSelectList.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                capitelSelectListMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                capitelSelectListMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                capitelSelectListMouseExited(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(capitelSelectList)
                    .addComponent(countryText, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addComponent(countryText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(capitelSelectList)
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(jLabel24)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(jLabel24)
                .addGap(0, 0, Short.MAX_VALUE))
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel8)
                    .addComponent(jLabel7)
                    .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        movieByDirectorAndYear.setIcon(new javax.swing.ImageIcon(getClass().getResource("/click-n-run-icon.png"))); // NOI18N
        movieByDirectorAndYear.setText("Go");
        movieByDirectorAndYear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                movieByDirectorAndYearActionPerformed(evt);
            }
        });

        movieYearBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/click-n-run-icon.png"))); // NOI18N
        movieYearBtn.setText("Go");
        movieYearBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                movieYearBtnActionPerformed(evt);
            }
        });

        whenBornBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/click-n-run-icon.png"))); // NOI18N
        whenBornBtn.setText("Go");
        whenBornBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                whenBornBtnActionPerformed(evt);
            }
        });

        bornInList.setForeground(new java.awt.Color(0, 51, 255));
        bornInList.setText("select from list");
        bornInList.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                bornInListMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                bornInListMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                bornInListMouseExited(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(bornInName)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(bornInList)
                .addContainerGap(50, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(bornInName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(bornInList))
        );

        jLabel21.setIcon(new javax.swing.ImageIcon(getClass().getResource("/assistance-support-point-query-icone-3769-32.png"))); // NOI18N

        jLabel1.setText("When were");

        jLabel2.setText("born?");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jLabel21)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel1)
                .addGap(10, 10, 10)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel2)
                .addGap(0, 20, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jLabel2))
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jLabel1)
                        .addComponent(jLabel21)))
                .addGap(0, 21, Short.MAX_VALUE))
        );

        profYearBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/click-n-run-icon.png"))); // NOI18N
        profYearBtn.setText("Go");
        profYearBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                profYearBtnActionPerformed(evt);
            }
        });

        directedByBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/click-n-run-icon.png"))); // NOI18N
        directedByBtn.setText("Go");
        directedByBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                directedByBtnActionPerformed(evt);
            }
        });

        jLabel17.setText("Which albums were created by");

        jLabel30.setIcon(new javax.swing.ImageIcon(getClass().getResource("/assistance-support-point-query-icone-3769-32.png"))); // NOI18N

        jLabel18.setText("?");

        artistList.setForeground(new java.awt.Color(0, 51, 255));
        artistList.setText("select from list");
        artistList.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                artistListMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                artistListMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                artistListMouseExited(evt);
            }
        });

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout.setHorizontalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addComponent(jLabel30)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel17)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel12Layout.createSequentialGroup()
                        .addComponent(artistList)
                        .addGap(0, 96, Short.MAX_VALUE))
                    .addGroup(jPanel12Layout.createSequentialGroup()
                        .addComponent(atristName)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))))
        );
        jPanel12Layout.setVerticalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel17)
                        .addComponent(jLabel18)
                        .addComponent(atristName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel30))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(artistList)
                .addContainerGap())
        );

        jLabel19.setText("Which artists created albums after");

        jLabel32.setIcon(new javax.swing.ImageIcon(getClass().getResource("/assistance-support-point-query-icone-3769-32.png"))); // NOI18N

        jLabel20.setText("?");

        javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
        jPanel13.setLayout(jPanel13Layout);
        jPanel13Layout.setHorizontalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel13Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel32)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel19)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(albumsAfterYear, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel20)
                .addContainerGap())
        );
        jPanel13Layout.setVerticalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel13Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel32)
                    .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel19)
                        .addComponent(jLabel20)
                        .addComponent(albumsAfterYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        jLabel10.setText("What movies were released in");

        jLabel12.setText("?");

        jLabel27.setIcon(new javax.swing.ImageIcon(getClass().getResource("/assistance-support-point-query-icone-3769-32.png"))); // NOI18N

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addComponent(jLabel27)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel10)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(movieYear, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel12))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jLabel10)
                .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(movieYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addComponent(jLabel27, javax.swing.GroupLayout.Alignment.TRAILING)
        );

        jLabel5.setText("?");

        jLabel4.setText(" were born in year");

        profListSelect.setForeground(new java.awt.Color(0, 51, 255));
        profListSelect.setText("select from list");
        profListSelect.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                profListSelectMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                profListSelectMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                profListSelectMouseExited(evt);
            }
        });

        jLabel6.setText(",");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(profInput, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabel6))
                    .addComponent(profListSelect))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(profInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addGap(1, 1, 1)
                .addComponent(profListSelect))
        );

        jLabel3.setText("Which people who have profession");

        jLabel23.setIcon(new javax.swing.ImageIcon(getClass().getResource("/assistance-support-point-query-icone-3769-32.png"))); // NOI18N

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jLabel23)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(profYear, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(0, 18, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addContainerGap()
                                .addComponent(jLabel3)))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel5)
                                .addComponent(profYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabel4)))
                    .addComponent(jLabel23))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        capitalBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/click-n-run-icon.png"))); // NOI18N
        capitalBtn.setText("Go");
        capitalBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                capitalBtnActionPerformed(evt);
            }
        });

        albumAfterYearBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/click-n-run-icon.png"))); // NOI18N
        albumAfterYearBtn.setText("Go");
        albumAfterYearBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                albumAfterYearBtnActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14);
        jPanel14.setLayout(jPanel14Layout);
        jPanel14Layout.setHorizontalGroup(
            jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel14Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel14Layout.createSequentialGroup()
                        .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(albumAfterYearBtn))
                    .addGroup(jPanel14Layout.createSequentialGroup()
                        .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jSeparator7, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPanel12, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jPanel7, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel14Layout.createSequentialGroup()
                                .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(movieYearBtn))
                            .addComponent(directedByBtn)
                            .addComponent(jSeparator3, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(whenBornBtn)
                            .addGroup(jPanel14Layout.createSequentialGroup()
                                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(capitalBtn))
                            .addComponent(jSeparator2)
                            .addGroup(jPanel14Layout.createSequentialGroup()
                                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(profYearBtn))
                            .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jSeparator4, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(albumByArtist)
                                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(jSeparator6, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel14Layout.createSequentialGroup()
                                        .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, 372, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(movieByDirectorAndYear))))
                            .addComponent(jSeparator5, javax.swing.GroupLayout.Alignment.LEADING))
                        .addGap(0, 3, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel14Layout.setVerticalGroup(
            jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel14Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel14Layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(whenBornBtn)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel14Layout.createSequentialGroup()
                        .addGap(28, 28, 28)
                        .addComponent(profYearBtn)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 11, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel14Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel14Layout.createSequentialGroup()
                        .addGap(16, 16, 16)
                        .addComponent(capitalBtn)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel14Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel14Layout.createSequentialGroup()
                        .addGap(14, 14, 14)
                        .addComponent(directedByBtn)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(movieYearBtn))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel14Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(jPanel14Layout.createSequentialGroup()
                        .addGap(29, 29, 29)
                        .addComponent(movieByDirectorAndYear)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(albumByArtist))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator7, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(albumAfterYearBtn))
                .addGap(32, 32, 32))
        );

        jScrollPane1.setViewportView(jPanel14);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 513, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 567, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void bornInListMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_bornInListMouseClicked
        new SelectionList(this, dataEx.getBornInPersons(), this.bornInName);
    }//GEN-LAST:event_bornInListMouseClicked

    private void profListSelectMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_profListSelectMouseClicked
        new SelectionList(this, dataEx.getProfPersons(), this.profInput);
    }//GEN-LAST:event_profListSelectMouseClicked

    private void bornInListMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_bornInListMouseEntered
        bornInList.setForeground(Color.red);
        Cursor handCursor = new Cursor(Cursor.HAND_CURSOR);
        setCursor(handCursor);
    }//GEN-LAST:event_bornInListMouseEntered

    private void bornInListMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_bornInListMouseExited
       bornInList.setForeground(Color.blue);
       Cursor normalCursor = new Cursor(Cursor.DEFAULT_CURSOR);
       setCursor(normalCursor);

    }//GEN-LAST:event_bornInListMouseExited

    private void profListSelectMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_profListSelectMouseEntered
        profListSelect.setForeground(Color.red);
        Cursor handCursor = new Cursor(Cursor.HAND_CURSOR);
        setCursor(handCursor);
    }//GEN-LAST:event_profListSelectMouseEntered

    private void profListSelectMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_profListSelectMouseExited
        profListSelect.setForeground(Color.blue);
        Cursor normalCursor = new Cursor(Cursor.DEFAULT_CURSOR);
        setCursor(normalCursor);
    }//GEN-LAST:event_profListSelectMouseExited

    private void capitelSelectListMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_capitelSelectListMouseClicked
        new SelectionList(this, dataEx.getAllCountries(), this.countryText);
    }//GEN-LAST:event_capitelSelectListMouseClicked

    private void capitelSelectListMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_capitelSelectListMouseEntered
        capitelSelectList.setForeground(Color.red);
        Cursor handCursor = new Cursor(Cursor.HAND_CURSOR);
        setCursor(handCursor);
    }//GEN-LAST:event_capitelSelectListMouseEntered

    private void capitelSelectListMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_capitelSelectListMouseExited
        capitelSelectList.setForeground(Color.blue);
        Cursor normalCursor = new Cursor(Cursor.DEFAULT_CURSOR);
        setCursor(normalCursor);
    }//GEN-LAST:event_capitelSelectListMouseExited

    private void capitalBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_capitalBtnActionPerformed
       // create the datalog query : Q(City):-Capitals(SelectedCountry, City)
        Vector<RelationVar> head = new Vector<RelationVar>();
        String country = countryText.getText();
        RelationVar countryRV = new RelationVar("Country");
//        head.add(countryRV);
        head.add(new RelationVar("City"));
        Vector<Relation> body = new  Vector<Relation>();
        Table table = dataEx.getCapitals();
        Vector<RelationVar> vars = new Vector<RelationVar>();
        vars.add(new EqualsSelection("Country", country));
        vars.add(countryRV);
        body.add(new Relation(table, table.getName(), vars));
        DLQuery capitalQuery = new DLQuery(head, body);
        try {
            Table ans = QueryEvaluator.findSafePlan(capitalQuery);
            // no results
            if (ans.getContent().size() == 0){
                JOptionPane.showMessageDialog(this, "No results found","No results",JOptionPane.INFORMATION_MESSAGE);
                return;
            }
            String query = "What is the capital of " + country + " ?";
            new ResultFrame(this, ans, query);
            //ans.print();
        } catch (Exception ex) {
            Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }//GEN-LAST:event_capitalBtnActionPerformed

    private void selectDirectorListMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_selectDirectorListMouseEntered
        selectDirectorList.setForeground(Color.red);
        Cursor handCursor = new Cursor(Cursor.HAND_CURSOR);
        setCursor(handCursor);
    }//GEN-LAST:event_selectDirectorListMouseEntered

    private void selectDirectorListMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_selectDirectorListMouseExited
        selectDirectorList.setForeground(Color.blue);
        Cursor normalCursor = new Cursor(Cursor.DEFAULT_CURSOR);
        setCursor(normalCursor);
    }//GEN-LAST:event_selectDirectorListMouseExited

    private void selectDirectorListMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_selectDirectorListMouseClicked
        new SelectionList(this, dataEx.getAllDirectors(), this.directedBy);
    }//GEN-LAST:event_selectDirectorListMouseClicked

    private void directedByBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_directedByBtnActionPerformed
    	// create the datalog query : 
    	// Q(Movie):-MovieDirectors(Movie, SelectedDirector)
    	Vector<RelationVar> head = new Vector<RelationVar>();
        String director = directedBy.getText();  
        RelationVar movieRV = new RelationVar("Movie");
        head.add(movieRV);
        head.add(new RelationVar("Director"));
        Vector<Relation> body = new  Vector<Relation>();
        Table table = dataEx.getDirectors();
        Vector<RelationVar> vars = new Vector<RelationVar>();
        vars.add(new EqualsSelection("Director", director));
        vars.add(movieRV);
        body.add(new Relation(table, table.getName(), vars));
        DLQuery directorQuery = new DLQuery(head, body);
        try {
            Table ans = QueryEvaluator.findSafePlan(directorQuery);
            // no results
            if (ans.getContent().size() == 0){
                JOptionPane.showMessageDialog(this, "No results found","No results",JOptionPane.INFORMATION_MESSAGE);
                return;
            }
            new ResultFrame(this, ans, directedByQuery.getText() + director + "?");
            //ans.print();
        } catch (Exception ex) {
            Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_directedByBtnActionPerformed

    private void movieYearBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_movieYearBtnActionPerformed
    	// create the datalog query : 
    	// Q(Movie):-MovieByYear(Movie, SelectedYear)
    	Vector<RelationVar> head = new Vector<RelationVar>();
        String year = movieYear.getText();  
        RelationVar movieRV = new RelationVar("Movie");
        head.add(movieRV);
        //head.add(new RelationVar("Year"));
        Vector<Relation> body = new  Vector<Relation>();
        Table table = dataEx.getMoviesByYear();
        Vector<RelationVar> vars = new Vector<RelationVar>();
        vars.add(new EqualsSelection("Year", year));
        vars.add(movieRV);
        body.add(new Relation(table, table.getName(), vars));
        DLQuery movieYearQuery = new DLQuery(head, body);
        try {
            Table ans = QueryEvaluator.findSafePlan(movieYearQuery);
            // no results
            if (ans.getContent().size() == 0){
                JOptionPane.showMessageDialog(this, "No results found","No results",JOptionPane.INFORMATION_MESSAGE);
                return;
            }
            String query = "What movies were released in " + year + " ?";
            new ResultFrame(this, ans, query);
            //ans.print();
        } catch (Exception ex) {
            Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_movieYearBtnActionPerformed

    private void directorMovieByYearListMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_directorMovieByYearListMouseClicked
        new SelectionList(this, dataEx.getAllDirectors(), this.directorMovieByYear);
    }//GEN-LAST:event_directorMovieByYearListMouseClicked

    private void directorMovieByYearListMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_directorMovieByYearListMouseExited
        directorMovieByYearList.setForeground(Color.blue);
        Cursor normalCursor = new Cursor(Cursor.DEFAULT_CURSOR);
        setCursor(normalCursor);
    }//GEN-LAST:event_directorMovieByYearListMouseExited

    private void directorMovieByYearListMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_directorMovieByYearListMouseEntered
        directorMovieByYearList.setForeground(Color.red);
        Cursor handCursor = new Cursor(Cursor.HAND_CURSOR);
        setCursor(handCursor);
    }//GEN-LAST:event_directorMovieByYearListMouseEntered

    private void movieByDirectorAndYearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_movieByDirectorAndYearActionPerformed
    	// create the datalog query : 
    	// Q(Movie):-MovieByYear(Movie, SelectedYear), MoviesDirector(Movie, SelectedDirector)
    	Vector<RelationVar> head = new Vector<RelationVar>();
        String director = directorMovieByYear.getText();
        String year = yearMovieByDirector.getText();
        RelationVar movieRV = new RelationVar("Movie");
        head.add(movieRV);
        //head.add(new RelationVar("Year"));
        //head.add(new RelationVar("Director"));
        Vector<Relation> body = new  Vector<Relation>();
        Table table1 = dataEx.getMoviesByYear();
        Table table2 = dataEx.getDirectors();
        Vector<RelationVar> vars1 = new Vector<RelationVar>();
        vars1.add(movieRV);
        vars1.add(new EqualsSelection("Year", year));
        Vector<RelationVar> vars2 = new Vector<RelationVar>();
        vars2.add(movieRV);
        vars2.add(new EqualsSelection("Director", director));
        body.add(new Relation(table1, table1.getName(), vars1));
        body.add(new Relation(table2, table2.getName(), vars2));
        DLQuery directedByInYear = new DLQuery(head, body);
        try {
            Table ans = QueryEvaluator.findSafePlan(directedByInYear);
            // no results
            if (ans.getContent().size() == 0){
                JOptionPane.showMessageDialog(this, "No results found","No results",JOptionPane.INFORMATION_MESSAGE);
                return;
            }
            String query = "Which movies that were directed by " + director + " were released in " + year + " ?";
            new ResultFrame(this, ans, query);
        //    ans.print();
        } catch (Exception ex) {
            Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_movieByDirectorAndYearActionPerformed

    private void whenBornBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_whenBornBtnActionPerformed
    	// create the datalog query : 
    	// Q(Person):-BornIn(Person, SelectedYear)
    	Vector<RelationVar> head = new Vector<RelationVar>();
        String name = bornInName.getText();
  //      head.add(new RelationVar("Person"));
        RelationVar yearRV = new RelationVar("Year");
        head.add(yearRV);
        Vector<Relation> body = new  Vector<Relation>();
        Table table = dataEx.getBornIn();
        Vector<RelationVar> vars = new Vector<RelationVar>();
        vars.add(new EqualsSelection("Person", name));
        vars.add(yearRV);
        body.add(new Relation(table, table.getName(), vars));
        DLQuery bornInQuery = new DLQuery(head, body);
        try {
            Table ans = QueryEvaluator.findSafePlan(bornInQuery);
            // no results
            if (ans.getContent().size() == 0){
                JOptionPane.showMessageDialog(this, "No results found","No results",JOptionPane.INFORMATION_MESSAGE);
                return;
            }
            new ResultFrame(this, ans, "When were " + name + " born?");
            //ans.print();
        } catch (Exception ex) {
            Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
        
       
    }//GEN-LAST:event_whenBornBtnActionPerformed

    private void profYearBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_profYearBtnActionPerformed
    	// create the datalog query : 
    	// Q(Person):-BornIn(Person, SelectedYear), Profession(Person, SelectedProf)
    	Vector<RelationVar> head = new Vector<RelationVar>();
        String prof = profInput.getText();
        String year = profYear.getText();
        RelationVar personRV = new RelationVar("Person");
        head.add(personRV);
        Vector<Relation> body = new  Vector<Relation>();
        Table table1 = dataEx.getBornIn();
        Table table2 = dataEx.getProfession();
        Vector<RelationVar> vars1 = new Vector<RelationVar>();
        vars1.add(personRV);
        vars1.add(new EqualsSelection("Year", year));
        Vector<RelationVar> vars2 = new Vector<RelationVar>();
        vars2.add(personRV);
        vars2.add(new EqualsSelection("Prof", prof));
        body.add(new Relation(table1, table1.getName(), vars1));
        body.add(new Relation(table2, table2.getName(), vars2));
        DLQuery profBornInYear = new DLQuery(head, body);
        try {
            Table ans = QueryEvaluator.findSafePlan(profBornInYear);
            // no results
            if (ans.getContent().size() == 0){
                JOptionPane.showMessageDialog(this, "No results found","No results",JOptionPane.INFORMATION_MESSAGE);
                return;
            }
            String query = "Which people who have profession " + prof + " were born in year " + year + " ?";
            new ResultFrame(this, ans, query);
           // ans.print();
        } catch (Exception ex) {
            Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_profYearBtnActionPerformed

    private void artistListMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_artistListMouseClicked
        new SelectionList(this, dataEx.getAllArtists(), this.atristName);
    }//GEN-LAST:event_artistListMouseClicked

    private void artistListMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_artistListMouseEntered
        artistList.setForeground(Color.red);
        Cursor handCursor = new Cursor(Cursor.HAND_CURSOR);
        setCursor(handCursor);
    }//GEN-LAST:event_artistListMouseEntered

    private void artistListMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_artistListMouseExited
        artistList.setForeground(Color.blue);
        Cursor normalCursor = new Cursor(Cursor.DEFAULT_CURSOR);
        setCursor(normalCursor);
    }//GEN-LAST:event_artistListMouseExited

    private void albumByArtistActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_albumByArtistActionPerformed
    	// create the datalog query : 
    	// Q(Album):-ArtistAlbums(SelectedArtist, Album)
    	Vector<RelationVar> head = new Vector<RelationVar>();
        String artist = atristName.getText();  
        RelationVar albumRV = new RelationVar("Album");
        head.add(albumRV);
        //head.add(new RelationVar("Artist"));
        Vector<Relation> body = new  Vector<Relation>();
        Table table = dataEx.getArtistsAlbums();
        Vector<RelationVar> vars = new Vector<RelationVar>();
        vars.add(new EqualsSelection("Artist", artist));
        vars.add(albumRV);
        body.add(new Relation(table, table.getName(), vars));
        DLQuery dlQuery = new DLQuery(head, body);
        try {
            Table ans = QueryEvaluator.findSafePlan(dlQuery);
            // no results
            if (ans.getContent().size() == 0){
                JOptionPane.showMessageDialog(this, "No results found","No results",JOptionPane.INFORMATION_MESSAGE);
                return;
            }
            String query = "Which albums were created by " + artist;
            new ResultFrame(this, ans, query);
            //ans.print();
        } catch (Exception ex) {
            Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_albumByArtistActionPerformed

    private void albumAfterYearBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_albumAfterYearBtnActionPerformed
    	// create the datalog query : 
    	// Q(Album):-Albums(Album, GraterThenSelectedYear), ArtistAlbums(Artist, Album)
    	Vector<RelationVar> head = new Vector<RelationVar>();
        String year = albumsAfterYear.getText();  
        RelationVar artistRV = new RelationVar("Artist");
        head.add(artistRV);
        RelationVar albumRV = new RelationVar("Album");
 //       head.add(new RelationVar("Year"));
        Vector<Relation> body = new  Vector<Relation>();
        Table table1 = dataEx.getAlbums();
        Table table2 = dataEx.getArtistsAlbums();
        Vector<RelationVar> vars1 = new Vector<RelationVar>();
        Vector<RelationVar> vars2 = new Vector<RelationVar>();
        vars1.add(albumRV);
        vars1.add(new GraterThenSelection("Year", year));
        vars2.add(artistRV);
        vars2.add(albumRV);
        body.add(new Relation(table1, table1.getName(), vars1));
        body.add(new Relation(table2, table2.getName(), vars2));
        DLQuery dlQuery = new DLQuery(head, body);
        try {
            Table ans = QueryEvaluator.findSafePlan(dlQuery);
            // no results
            if (ans.getContent().size() == 0){
                JOptionPane.showMessageDialog(this, "No results found","No results",JOptionPane.INFORMATION_MESSAGE);
                return;
            }
            String query = "Which artists created albums after " + year + " ?";
            new ResultFrame(this, ans, query);
            //ans.print();
        } catch (Exception ex) {
            Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }//GEN-LAST:event_albumAfterYearBtnActionPerformed


    
    public void setBornInName(String name){
        this.bornInName.setText(name);
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton albumAfterYearBtn;
    private javax.swing.JButton albumByArtist;
    private javax.swing.JTextField albumsAfterYear;
    private javax.swing.JLabel artistList;
    private javax.swing.JTextField atristName;
    private javax.swing.JLabel bornInList;
    private javax.swing.JTextField bornInName;
    private javax.swing.JButton capitalBtn;
    private javax.swing.JLabel capitelSelectList;
    private javax.swing.JTextField countryText;
    private javax.swing.JTextField directedBy;
    private javax.swing.JButton directedByBtn;
    private javax.swing.JLabel directedByQuery;
    private javax.swing.JTextField directorMovieByYear;
    private javax.swing.JLabel directorMovieByYearList;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JSeparator jSeparator4;
    private javax.swing.JSeparator jSeparator5;
    private javax.swing.JSeparator jSeparator6;
    private javax.swing.JSeparator jSeparator7;
    private javax.swing.JButton movieByDirectorAndYear;
    private javax.swing.JTextField movieYear;
    private javax.swing.JButton movieYearBtn;
    private javax.swing.JTextField profInput;
    private javax.swing.JLabel profListSelect;
    private javax.swing.JTextField profYear;
    private javax.swing.JButton profYearBtn;
    private javax.swing.JLabel selectDirectorList;
    private javax.swing.JButton whenBornBtn;
    private javax.swing.JTextField yearMovieByDirector;
    // End of variables declaration//GEN-END:variables

    void clearTextFields() {
        this.bornInName.setText("");
        this.countryText.setText("");
        this.profInput.setText("");
        this.profYear.setText("");
        this.directedBy.setText("");
        this.movieYear.setText("");
        this.yearMovieByDirector.setText("");
        this.directorMovieByYear.setText("");
        this.albumsAfterYear.setText("");
        this.atristName.setText("");
    }
}
